package com.fanxuankai.boot.mqbroker.event;

import com.alibaba.fastjson.JSON;
import com.fanxuankai.boot.mqbroker.constant.CommonConstants;
import com.fanxuankai.boot.mqbroker.consumer.EventListener;
import com.fanxuankai.boot.mqbroker.consumer.Listener;
import com.fanxuankai.boot.mqbroker.domain.User;
import com.fanxuankai.boot.mqbroker.Event;
import org.springframework.stereotype.Service;

/**
 * @author fanxuankai
 */
@Service
@Listener(CommonConstants.USER_TOPIC)
public class UserEventListener implements EventListener<User> {
    @Override
    public void onEvent(Event<User> event) {
        System.out.println("接收到事件: " + JSON.toJSONString(event));
    }
}